<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>哥德巴赫猜想</title>
</head>
<body>
    <script>
        function judge(n) {
            var count = 0;
            for (i = 1 ; i <= n ; i++) {
                if(n % i === 0) {
                    count++
                }
            }
            if (count === 2) {
                return true
            } else {
                return false
            }
        }

        function test(n) {
            if (n % 2 !== 0) {
                console.log(n + '不是偶数')
            } else {
                for (var i = 1 ; i <= n/2 ; i++) {
                if (judge(i) && judge(n-i)) {
                    console.log('偶数' + n +'='+ '质数'+ i + '+' +'质数'+(n-i))
                    break;
                }
            }
            }
        }
        test(18)
        test(19)
        test(30)
    </script>
</body>
</html>